/*
  File:    DiscreteReinit.h
  Purpose: Fast but inaccurate level set reinitialization.   

  Contact: Paul Macklin
           pmacklin@math.uci.edu
		  http://math.uci.edu/~pmacklin
*/

#include "Contour.h"

#ifndef __DiscreteReinit_h__
#define __DiscreteReinit_h__

class ReinitNode{
public:
 bool Trial;
 bool Known;
 bool Far;
 double Data;
 int i;
 int j;
 ReinitNode* pNextReinitNode;

 ReinitNode();
};

class ReinitMatrix{
public:
 int Rows;
 int Cols;
 ReinitNode** Nodes;

 ReinitMatrix();
 void SetSize( int NewRows , int NewCols );
 
 ReinitNode* operator()(int i, int j);
 
 ~ReinitMatrix();
};

double UpdateNode( ReinitMatrix& Input , int i, int j );

double MinimumDistanceSquared( Contour& InputContour , double x, double y );
Matrix DiscreteReinit(Matrix &mIn);
Matrix LinearDiscreteReinit( Matrix& Input );
Matrix DiscreteReinit(Matrix &Input, Contour& ZeroContour );

#endif
